﻿CREATE TABLE [dbo].[BemanningValdistrikt] (
    [Id]            UNIQUEIDENTIFIER NOT NULL,
    [ValId]         UNIQUEIDENTIFIER NOT NULL,
    [Skapad]        DATETIME         NOT NULL,
    [SkapadAv]      NVARCHAR (50)    NOT NULL,
    [Andrad]        DATETIME         NULL,
    [AndradAv]      NVARCHAR (50)    NULL,
    [PersonId]      UNIQUEIDENTIFIER NULL,
    [FunktionId]    UNIQUEIDENTIFIER NOT NULL,
    [ValdistriktId] UNIQUEIDENTIFIER NOT NULL,
    [TackatJa]      BIT              NOT NULL,
    [MilErsattning] FLOAT (53)       NULL,
    [TaxiUtlagg]    FLOAT (53)       NULL,
    CONSTRAINT [PK_BemanningValdistrikt] PRIMARY KEY CLUSTERED ([Id] ASC, [ValId] ASC),
    CONSTRAINT [FK_BemanningValdistrikt_Funktion] FOREIGN KEY ([FunktionId], [ValId]) REFERENCES [dbo].[Funktion] ([Id], [ValId]),
    CONSTRAINT [FK_BemanningValdistrikt_Person] FOREIGN KEY ([PersonId], [ValId]) REFERENCES [dbo].[Person] ([Id], [ValId]),
    CONSTRAINT [FK_BemanningValdistrikt_Valdistrikt] FOREIGN KEY ([ValdistriktId], [ValId]) REFERENCES [dbo].[Valdistrikt] ([Id], [ValId])
);









